package com.ydl.shopping.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ydl.shopping.core.entity.TreeSelect;
import com.ydl.shopping.domain.TbMenu;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
public interface ITbMenuService extends IService<TbMenu> {
    QueryWrapper<TbMenu> queryWrapper(TbMenu entity);

    /**
     * 新增菜单
     *
     * @param tbMenu 菜单信息
     * @return 错误消息/null
     */
    String saveMenu(TbMenu tbMenu);

    /**
     * 获取菜单最大层级
     *
     * @return 层级
     */
    int getMenuMaxLevel();

    /**
     * 菜单树
     *
     * @param tbMenu 菜单信息
     * @return 菜单树
     */
    List<TbMenu> tree(TbMenu tbMenu);

    /**
     * 路由规则
     *
     * @param userId 用户ID
     * @return 路由规则
     */
    List<TbMenu> router(Long userId);

    /**
     * 菜单下拉树
     *
     * @param userId 用户ID
     * @return 下拉框
     */
    List<TreeSelect> select(Long userId);
}
